<template>
    <div class="searchList">
		<h1 class="historysearcht">历史搜索</h1>		
		<ul>
			<li @click="" v-for="(item,index) of list ":key="index">{{item.name}}</li>
		</ul>
	</div>
</template>

<script>
	import local from '../../local/local.js'
	export default{
		data(){
			return{
				list:[]
			}
		},
		methods:{
			saveToHistory(name){				
				let index = this.list.find(item=>item.name == name);
				if(index){
					return false;
				}
				
				this.list.push({name:name});
				local.setSearchHistory(this.list);
			}
		},
		mounted(){
			if(local.getSearchHistory()){
				this.list = local.getSearchHistory();
			}
		}
	}
</script>

<style>
.searchList{margin-top: .9rem;overflow: hidden;margin-left: .4rem;}
.historysearcht{background: none;height: .5rem;line-height: 0.5rem;font-weight: 100;color: #333;font-size: .25rem;}
.searchList li{ width: 90%;height: .7rem;color: #333;line-height: 0.7rem;font-size: .2rem;border-bottom: .01rem solid rgba(0,0,0,.14);}
</style>